import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AssetCatalogVO, AssetCatalogForm, AssetCatalogQuery } from '@/api/business/assetCatalog/type';

/**
 * 查询资产目录列表
 * @param query
 * @returns {*}
 */

export const listAssetCatalog = (query?: AssetCatalogQuery): AxiosPromise<AssetCatalogVO[]> => {
  return request({
    url: '/business/assetCatalog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询资产目录详细
 * @param id
 */
export const getAssetCatalog = (id: string | number): AxiosPromise<AssetCatalogVO> => {
  return request({
    url: '/business/assetCatalog/' + id,
    method: 'get'
  });
};

/**
 * 新增资产目录
 * @param data
 */
export const addAssetCatalog = (data: AssetCatalogForm) => {
  return request({
    url: '/business/assetCatalog',
    method: 'post',
    data: data
  });
};

/**
 * 修改资产目录
 * @param data
 */
export const updateAssetCatalog = (data: AssetCatalogForm) => {
  return request({
    url: '/business/assetCatalog',
    method: 'put',
    data: data
  });
};

/**
 * 删除资产目录
 * @param id
 */
export const delAssetCatalog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/assetCatalog/' + id,
    method: 'delete'
  });
};
